//
//  JThirdTableCell.m
//  HeadIndustry
//
//  Created by jun on 2017/8/30.
//  Copyright © 2017年 jun. All rights reserved.
//

#import "JThirdTableCell.h"

@implementation JThirdTableCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        self.opaque = NO;
        self.backgroundColor = [UIColor whiteColor];
        [self setUpView];
    }
    return self;
}

- (void)setUpView {
    _statueLabel = [YYLabel new];
    _statueLabel.top = 0;
    _statueLabel.left = 20;
    _statueLabel.size = CGSizeMake(kWindowW - 40, 40);
    _statueLabel.font = kFONT_TITLE(16);
    _statueLabel.textColor = kRGBColor(78, 78, 78);
    _statueLabel.textAlignment = NSTextAlignmentCenter;
    _statueLabel.numberOfLines = 0;
    _statueLabel.text = @"售后说明";
    [self addSubview:_statueLabel];
    
    CALayer *line1 = [CALayer layer];
    line1.contents = (__bridge id _Nullable)([UIImage imageNamed:@"pzh"].CGImage);
    line1.centerY = _statueLabel.centerY;
    line1.left = _statueLabel.width/2.0 - 80 ;
    line1.size = CGSizeMake(40, 1);
    [self.layer addSublayer:line1];
    
    CALayer *line2 = [CALayer layer];
    line2.contents = (__bridge id _Nullable)([UIImage imageNamed:@"pzh"].CGImage);
    line2.centerY = _statueLabel.centerY;
    line2.left = _statueLabel.width/2.0 + 80 ;
    line2.size = CGSizeMake(40, 1);
    [self.layer addSublayer:line2];
    
    _statueTextLabel = [YYLabel new];
    _statueTextLabel.top = _statueLabel.bottom;
    _statueTextLabel.left = 10;
    _statueTextLabel.size = CGSizeMake(kWindowW - 20, 40);
    _statueTextLabel.font = kFONT_TITLE(14);
    _statueTextLabel.textColor = kRGBColor(78, 78, 78);
    _statueTextLabel.textAlignment = NSTextAlignmentLeft;
    _statueTextLabel.numberOfLines = 0;
    [self addSubview:_statueTextLabel];
    
}

- (void)setContentStr:(NSString *)contentStr
{
    _contentStr = contentStr;
    NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[contentStr dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
    
    _statueTextLabel.attributedText = attrStr;
    CGSize sizeLable = [_statueTextLabel sizeThatFits:CGSizeMake(kWindowW - 20, 1000)];
    
    _statueTextLabel.size = CGSizeMake(kWindowW - 20, sizeLable.height);
    
}

- (CGFloat)thirdViewHeight
{
    CGSize sizeLable = [_statueTextLabel sizeThatFits:CGSizeMake(kWindowW - 20, 1000)];
    return sizeLable.height +40;
}

@end
